package com.biyeshengjiuye.controller;


import com.alibaba.fastjson.JSON;
import com.biyeshengjiuye.entity.Employment;
import com.biyeshengjiuye.entity.Enterprise;
import com.biyeshengjiuye.service.EmploymentService;
import com.biyeshengjiuye.service.UserEnterService;
import com.biyeshengjiuye.vo.EmplVo;
import com.biyeshengjiuye.vo.EnterVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class InfoController {

    @Resource
    private EmploymentService employmentService;
    @Resource
    private UserEnterService userEnterService;

    @ResponseBody
    @RequestMapping("/infoJob")
    public void getInfoJob(HttpSession session, Integer id,EnterVo enterVo,EmplVo emplVo){
        Map<String,Object> map = new HashMap<String,Object>();
        emplVo.setId(id);
        List<Employment> employment = employmentService.findEmploymentByPageById(emplVo);
        enterVo.setE_id(employment.get(0).getE_id());
        List<Enterprise> enterprises = userEnterService.findEnterpriseByPageById(enterVo);
        session.setAttribute("jobInfo",employment.get(0));
        session.setAttribute("enterInfo",enterprises.get(0));

    }
}
